<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<link href="images/reset.css?v={yun:}$config.cachecode{/yun}" rel="stylesheet" type="text/css" />
<link href="images/system.css?v={yun:}$config.cachecode{/yun}" rel="stylesheet" type="text/css" />
<link href="images/table_form.css?v={yun:}$config.cachecode{/yun}" rel="stylesheet" type="text/css" />
<script src="{yun:}$config.sy_weburl{/yun}/js/jquery-1.8.0.min.js?v={yun:}$config.cachecode{/yun}"></script>
<script src="js/admin_public.js?v={yun:}$config.cachecode{/yun}" language="javascript"></script>
<script src="{yun:}$config.sy_weburl{/yun}/js/ueditor/ueditor.config.js?v={yun:}$config.cachecode{/yun}"></script>
<script src="{yun:}$config.sy_weburl{/yun}/js/ueditor/ueditor.all.min.js?v={yun:}$config.cachecode{/yun}"></script>
<link href="{yun:}$config.sy_weburl{/yun}/js/layui/css/layui.css?v={yun:}$config.cachecode{/yun}" rel="stylesheet">
<link href="{yun:}$com_style{/yun}/images/m_style.css?v={yun:}$config.cachecode{/yun}" type="text/css" rel="stylesheet"/>
<script src="{yun:}$config.sy_weburl{/yun}/js/layui/layui.js?v={yun:}$config.cachecode{/yun}" language="javascript"></script>
<script src="{yun:}$config.sy_weburl{/yun}/js/layui/phpyun_layer.js?v={yun:}$config.cachecode{/yun}"></script>
<title>后台管理</title>
</head>
<script>
    function returnmessagereward(frame_id){
        if(frame_id==''||frame_id==undefined){
            frame_id='supportiframe';
        }
        var message = $(window.frames[frame_id].document).find("#layer_msg").val();
        if(message != null){
            var url=$(window.frames[frame_id].document).find("#layer_url").val();
            var layer_time=$(window.frames[frame_id].document).find("#layer_time").val();
            var layer_st=$(window.frames[frame_id].document).find("#layer_st").val();
            var layer_url = $(window.frames[frame_id].document).find("#layer_url").val();
            layer.closeAll('loading');
            if(layer_st=='9'){
                //判断是否开启职位推广并且是新增职位
                $('#jobid').val(layer_url);
                $.layer({
                    type : 1,
                    move:false,
                    fix: true,
                    zIndex:666,
                    title : '系统提示',
                    border : [10 , 0.3 , '#000', true],
                    area : ['480px','330px'],
                    page : {dom : '#addjob'},
                    close: function(){
                        window.location.href = "index.php?m=reward&key={yun:}$key{/yun}";
                    }
                });
            }else{
                if(url=='1'){
                    layer.msg(message, layer_time, Number(layer_st),function(){window.location.reload();window.event.returnValue = false;return false;});
                }else if(url==''){

                    layer.msg(message, layer_time, Number(layer_st));
                }else{
                    layer.msg(message, layer_time, Number(layer_st),function(){window.location.href = url;window.event.returnValue = false;return false;});
                }
            }
        }
    }
</script>
<body class="body_ifm">
<div class="infoboxp">
<!--<div class="admin_new_tip">-->
<!--<a href="javascript:;" class="admin_new_tip_close"></a>-->
<!--<a href="javascript:;" class="admin_new_tip_open" style="display:none;"></a>-->
<!--<div class="admin_new_tit"><i class="admin_new_tit_icon"></i>操作提示</div>-->
<!--<div class="admin_new_tip_list_cont">-->
<!--<div class="admin_new_tip_list">添加商品，网站运营者可以将周边产品或已合作商家把购买高频率商品以积分兑换形式放在网站！用户积分达到一定积分可以兑换！增强网站用户互动性！</div>-->
<!--</div>-->
<!--</div>-->
<div class="clear"></div>
<div class="tag_box mt10"  style="border: 0">
    <iframe id="supportiframejob1"  name="supportiframejob1" onload="returnmessagereward('supportiframejob1');" style="display:none"></iframe>
    <form name="myform" id="rewardform" action="index.php?m=reward&c=save" method="post" encType="multipart/form-data" target="supportiframejob1" class="layui-form">
        <input type="hidden" name="key" value="{yun:}$key{/yun}"/>
        <div class="form-search-title"><span class="bl-title">添加商品</span></div>
        <div class="form-search-content">
            <div class="bl-row">
                <div class="bl-col bl-col-4 "><div class="grid-content"></div></div>
                <div class="bl-col bl-col-8 ">
                    <div class="bl-form-item">
                        <div class="bl-form-item__label" style="width: 120px;">商品名称 :</div>
                        <div class="bl-form-item__content"  style="margin-left: 120px;">
                            <input type="text" name="name" id="name" size="60" lay-verify="required" value="{yun:}$info.name{/yun}" autocomplete="off" class="layui-input" placeholder="输入商品名称">
                        </div>
                    </div>
                </div>
                <div class="bl-col bl-col-8 ">
                    <div class="bl-form-item">
                        <div class="bl-form-item__label" style="width: 120px;">商品图片 :</div>
                        <div class="bl-form-item__content"  style="margin-left: 120px;">
                            <button type="button" class="yun_bth_pic adminupload" lay-data="{name: 'pic',imgid: 'imgicon'}">上传图片</button>
                            <input type="hidden" id="layupload_type" value="2"/>
                            <input type="hidden" id="upload_path" value="reward"/>
                            <input type="hidden" name="pic" value="{yun:}$info.pic{/yun}"/>
                            <img id="imgicon" src="{yun:}$config.sy_weburl{/yun}/{yun:}$info.pic{/yun}" width="50" height="40" {yun:}if !$info.pic{/yun}class="none"{yun:}/if{/yun}>
                        </div>
                    </div>
                </div>
                <div class="bl-col bl-col-4 "><div class="grid-content"></div></div>
                <div class="bl-clear"></div>
            </div>

            <div class="bl-row">
                <div class="bl-col bl-col-4 "><div class="grid-content"></div></div>
                <div class="bl-col bl-col-8 ">
                    <div class="bl-form-item">
                        <div class="bl-form-item__label" style="width: 120px;">兑换积分 :</div>
                        <div class="bl-form-item__content"  style="margin-left: 120px;">
                            <input type="text" name="integral" id="integral" size="60" lay-verify="required" value="{yun:}$info.integral{/yun}" autocomplete="off" class="layui-input" placeholder="输入兑换积分" onkeyup="this.value=this.value.replace(/[^0-9-]/g,'')">
                        </div>
                    </div>
                </div>
                <div class="bl-col bl-col-8 ">
                    <div class="bl-form-item">
                        <div class="bl-form-item__label" style="width: 120px;">限购数量 :</div>
                        <div class="bl-form-item__content"  style="margin-left: 120px;">
                            <input type="text" name="restriction" id="restriction"  lay-verify="required" value="{yun:}$info.restriction{/yun}" size="60"  autocomplete="off" class="layui-input" placeholder="输入限购数量" onkeyup="this.value=this.value.replace(/[^0-9-]/g,'')">
                        </div>
                    </div>
                </div>
                <div class="bl-col bl-col-4 "><div class="grid-content"></div></div>
                <div class="bl-clear"></div>
            </div>

            <div class="bl-row">
                <div class="bl-col bl-col-4 "><div class="grid-content"></div></div>
                <div class="bl-col bl-col-8 ">
                    <div class="bl-form-item">
                        <div class="bl-form-item__label" style="width: 120px;">库存数量 :</div>
                        <div class="bl-form-item__content"  style="margin-left: 120px;">
                            <input type="text" name="stock" id="stock" size="60" lay-verify="required" value="{yun:}$info.stock{/yun}" autocomplete="off" class="layui-input" placeholder="输入库存数量" onkeyup="this.value=this.value.replace(/[^0-9-]/g,'')">
                        </div>
                    </div>
                </div>
                <div class="bl-col bl-col-8 ">
                    <div class="bl-form-item">
                        <div class="bl-form-item__label" style="width: 120px;">排  序 :</div>
                        <div class="bl-form-item__content"  style="margin-left: 120px;">
                            <input type="text"  name="sort" id="sort"  lay-verify="required" value="{yun:}$info.sort{/yun}" size="60"  autocomplete="off" class="layui-input" placeholder="输入排序越小越在前" onkeyup="this.value=this.value.replace(/[^0-9-]/g,'')">
                        </div>
                    </div>
                </div>
                <div class="bl-col bl-col-4 "><div class="grid-content"></div></div>
                <div class="bl-clear"></div>
            </div>

            <div class="bl-row">
                <div class="bl-col bl-col-4 "><div class="grid-content"></div></div>
                <div class="bl-col bl-col-16 ">
                    <div class="bl-form-item">
                        <div class="bl-form-item__label" style="width: 120px;">简介内容 :</div>
                        <div class="bl-form-item__content"  style="margin-left: 120px;">
                            <!--<input type="date" name="entry_time" id="entry_time"  lay-verify="required" value="{yun:}$row.entry_time{/yun}" size="60"  autocomplete="off" class="layui-input" style="display:inline;width:400px;">-->
                            <script id="myEditor" name="content" type="text/plain" style="width:700px;height:300px;">{yun:}$info.content{/yun}
		                    </script>
                        </div>
                    </div>
                </div>
                <div class="bl-col bl-col-4 "><div class="grid-content"></div></div>
                <div class="bl-clear"></div>
            </div>

            <div class="bl-row">
                <div class="bl-col bl-col-4 "><div class="grid-content"></div></div>
                <div class="bl-col bl-col-8 ">
                    <div class="bl-form-item">
                        <div class="bl-form-item__label" style="width: 120px;">状  态 :</div>
                        <div class="bl-form-item__content"  style="margin-left: 120px;">
                            <input type="radio" name="status" value="1" id="status_1" title="上架" {yun:}if $info.status==1{/yun}checked{yun:}/if{/yun}>
                            <input type="radio" name="status" value="0" id="status_0" title="下架" {yun:}if $info.status==0{/yun}checked{yun:}/if{/yun}>                        </div>
                    </div>
                </div>
                <div class="bl-col bl-col-4 "><div class="grid-content"></div></div>
                <div class="bl-clear"></div>
            </div>

        </div>

        <div class="bl-row">
            <div class="bl-formbutton-box">
                <input type="button" value="取消" class="admin_new_bth" onclick="back()">
                {yun:}if $info.id{/yun}
                <input type="hidden" name="id" value="{yun:}$info.id{/yun}"/>
                <!--<input class="admin_new_cz_tj" type="button" onclick="checkform()" value="&nbsp;更 新&nbsp;"  />-->
                <input type="button" value="更新" class="admin_new_cz_tj"  onclick="checkform()" >
                {yun:}else{/yun}
                <!--<input class="admin_new_cz_tj" type="button" onclick="checkform()" value="&nbsp;添 加&nbsp;"  />-->
                <input type="button" value="确认" class="admin_new_cz_tj"  onclick="checkform()" >
                {yun:}/if{/yun}
            </div>
        </div>
      <!--</table>-->
    </form>
  </div>
</div>
<div class="job_tck_box" id="addjob" style="display:none;">
    <div class="job_box_div" style="width:440px;">
        <div class="jonadd_prompt_icon"></div>
        <div class="jonadd_prompt">
            <div class="jonadd_prompt_p"><span id="returnmsg" class="job_add_success">商品添加成功！</span></div>

            <a href="javascript:void(0)"  onclick="addjob_continue();return false;" class="job_add_continue">继续添加商品</a>
        </div>
    </div>
</div>
<script>
var weburl = '{yun:}$config.sy_weburl{/yun}';
layui.use(['layer', 'form'], function(){
    var layer = layui.layer
    ,form = layui.form
    ,$ = layui.$
	,url=weburl+"/index.php?m=ajax&c=get_redeem_option";
	 form.on('select(nid)', function(data){
      $.post(url,{tnid : data.value},function(html){
        $("#tnid").html(html);
        form.render();
      });
    });
});
function checkform(){
	if ($("#name").val()==""){
		parent.layer.msg('请填写商品名称！', 2, 8);return false;
	}
	if ($("#nid").val()==""){
		parent.layer.msg('请填写商品类别！', 2, 8);return false;
	}
	if ($("#pic").val()==""){
		parent.layer.msg('请上传商品图片！', 2, 8);return false;
	}
	if ($("#integral").val()==""){
		parent.layer.msg('请填写兑换{yun:}$config.integral_pricename{/yun}！', 2, 8);return false;
	}
	if ($("#restriction").val()==""){
		parent.layer.msg('请填写限购数量！', 2, 8);return false;
	}
	if ($("#stock").val()==""){
		parent.layer.msg('请填写库存数量！', 2, 8);return false;
	} 
	$("#rewardform").submit();
}
UE.getEditor('myEditor',{
	toolbars:[['Source', 'Bold', 'italic', 'underline', 'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright','insertorderedlist', 'insertunorderedlist','emotion','simpleupload']],
	wordCount:false,
    elementPathEnabled:false,
    initialFrameHeight:180
});
    function back(){
        window.history.go(-1);
    }


function addjob_continue(){
    var gourl='index.php?m=reward&c=add&key={yun:}$key{/yun}';
    window.location.href=gourl;
    window.event.returnValue = false;
    return false;
}
</script>
<script src="{yun:}$config.sy_weburl{/yun}/js/layui.upload.js?v={yun:}$config.cachecode{/yun}" type='text/javascript'></script> 
</body>
</html>